package intelligent_driver;

import intelligent_driver.Frame;
import intelligent_driver.Panel;

public class Main {

	/**
	 * @param args
	 * @throws Exception 
	 */
	public static void main(String[] args) throws Exception {
		Frame frame = new Frame("tr-sim");
		Panel panel = new Panel(400, 400);
		frame.add(panel);
		
		Lane l = new Lane(200*8); //~200*7.5
		Car c1 = new Car(200, 25, 10, 37.5, 30, 4);
		Car c2 = new Car(160, 7.5, 20, 37.5, 30, 4);
		Car c3 = new Car(120, 20, 7, 37.5, 30, 4);
		Car c4 = new Car(80, 7.5, 7.5, 37.5, 30, 4);
		Car c5 = new Car(40, 27, 20, 37.5, 30, 4);
		l.addVehicle(c1);
		l.addVehicle(c2);
		l.addVehicle(c3);
		l.addVehicle(c4);
		l.addVehicle(c5);
		
		int simsteps = 20;
		for(int i = 0; i < simsteps; i++){
			panel.update(l.getVq());
			panel.repaint();
			l.moveVehicles(0.1);
			Thread.sleep(100);
		}
	}

}
